import Vue from 'vue'
import VueRouter from 'vue-router'
import login from '../views/login.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'login',
    component: login
  },
  {
    path: '/home',
    name: 'home',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/home.vue'),
    children: [{
      path: '',
      name: 'homeself',
      meta:[],
      component:()=>import('../views/homeself')
    },{
      path: '/userlist',
      name: 'userlist',
      meta:['数据管理','用户列表'],
      component:()=>import('../views/userlist')
    },{
      path: '/adminlist',
      name: 'adminlist',
      meta:['数据管理','管理员列表'],
      component:()=>import('../views/adminlist')
    },{
      path: '/orderlist',
      name: 'orderlist',
      meta:['数据管理','订单列表'],
      component:()=>import('../views/orderlist')
    },{
      path: '/foodlist',
      name: 'foodlist',
      meta:['数据管理','食品列表'],
      component:()=>import('../views/foodlist')
    },]
  }
]

const router = new VueRouter({
  routes
})

export default router
